<template>
  <MainFrame>
    <div slot='content'>
      <div class="top-title">
        运行日志
      </div>
      <div class="page">
        <el-table :data="items" border style="width: 100%" stripe>
          <el-table-column prop="addTime" label="操作时间" width="200">
          </el-table-column>
          <el-table-column prop="account" label="用户" width="200">
          </el-table-column>
          <el-table-column prop="content" label="日志" width="300">
          </el-table-column>
        </el-table>
        <div style="margin: 10px 0;">
          <el-pagination layout="prev, pager, next" :page-size="pageSize" :current-page.sync="currentPage" :page-count="totalPage" @current-change="pageChange">
          </el-pagination>
        </div>
      </div>
    </div>
  </MainFrame>
</template>
<script>
import MainFrame from '@/components/MainFrame';
import utils from '../ttJs/utils.js'
import { validateData } from '../ttJs/utils.js'
export default {
  components: {
    MainFrame,
  },
  data() {
    return {
      items: [],
      currentPage: 1,
      pageSize: 0,
      totalPage: 0
    };
  },
  mounted: function() {
    this.getItems()
  },
  methods: {
    getItems() {
      var self = this;
      var url = '/yitai/admin/user/logs';
      var params = { page: self.currentPage };
      var success = function(response) {
        self.items = response.info;
        self.currentPage = response.page;
        self.pageSize = response.size;
        self.totalPage = response.total;
      }
      var fail = function() {}
      var complete = function() {}
      utils.requestLoading(url, params, success, fail, complete)
    },
    pageChange(pageNum) {
      this.currentPage = pageNum;
      this.getItems();
    }
  }
}

</script>
<style scoped rel="stylesheet/scss" lang="scss">
.top-title {
  font-size: 18px;
  font-weight: bold;
  padding: 0 20px;
}

.page {
  position: relative;
  overflow: hidden;
  padding: 20px;
}

</style>
